package com.xu.system.enums;

import com.xu.redis.sequence.ISequenceRule;

/**
 * 序列号生成枚举
 *
 * @Author: 许乾伟
 * @Date: 2024/3/22 14:05
 */
public enum SequenceEnum implements ISequenceRule {
    /**
     * 用户编码规则
     */
    USER_CODE_RULE("U", "", 4),
    /**
     * 角色编码规则
     */
    ROLE_CODE_RULE("R","" ,4 ),
    /**
     * 菜单编码规则
     */
    MENU_CODE_RULE("M","" ,4 ),
    /**
     * 部门编码规则
     */
    DEPT_CODE_RULE("D","" ,4 );

    /**
     * 前缀
     */
    private final String prefix;
    /**
     * 填充日期格式
     */
    private final String pattern;
    /**
     * 长度
     */
    private final Integer length;


    SequenceEnum(String prefix,String pattern,Integer length){
        this.prefix = prefix;
        this.pattern = pattern;
        this.length = length;
    }
    @Override
    public String prefix() {
        return this.prefix;
    }

    @Override
    public Integer length() {
        return this.length;
    }

    @Override
    public String pattern() {
        return this.pattern;
    }
}
